package receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.widget.Toast;

import com.example.a514.VibrateBroadCast;

public class Vibrate extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO: This method is called when the BroadcastReceiver is receiving
        // an Intent broadcast.
        if (intent!=null && intent.getAction().equals(VibrateBroadCast.SHOCK_ACTION)){
            Toast.makeText(context,"震动",Toast.LENGTH_LONG).show();
            Vibrator vb = (Vibrator)context.getSystemService(Context.VIBRATOR_SERVICE);

            vb.vibrate(100);
        }
        throw new UnsupportedOperationException("Not yet implemented");


    }
}